// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	10/22/2014 3:45:33 PM				
// -----------------------------

#ifndef _FileManager_h
#define _FileManager_h

#include "Common.h"

class FileManager
{
public:
	FileManager();
	~FileManager();

	Bool	Init();
	void	Clean();

	void	UnpackLibrary(WORD resourceId, const TString& FileName);
	void	UnpackResource(WORD resourceId, const TString& ResourceType, const TString& Identifier);

	void	AddResource(const TString& Identifier, const TString& File);

	TString	GetUniqueFileName() const;
	TString	GetFileName(const TString& Identifier) const;

private:

	static FileManager* s_lpInstance;
	static Bool			s_IsCleaned;
	static void AtPanic();

	void	ExtractResource(WORD resourceId, const TString& FileName, const TString& ResourceType);
	void	UnloadLibrary(const TString& FileName);
	void	UnloadResource(const TString& FileName);

	vector<TString>			m_Libraries;
	map<TString, TString>	m_Resources;

	FileManager(const FileManager& refFileManager);
	FileManager& operator=(const FileManager& refFileManager);
};

#endif